<template>
  <p>msg:{{ state }}</p>
  <div>
    <el-button type="primary" size="default" @click="save">改变msg</el-button>
  </div>
  <p>count: {{ count }}</p>
</template>

<script setup>
import { useStorage } from '@vueuse/core'
// 使用useStorage创建一个响应式的引用，与sessionStorage中的"msg"键关联
// const state = useStorage("msg", "你好")
const state = useStorage('msg', '你好', sessionStorage)
const save = () => {
  state.value += '!!!'
}
import { useGlobalState } from '../store'
const { count } = useGlobalState()
</script>

<style lang="scss" scoped></style>
